Repository navigation
feat(orm): chainable skip() / offset() / take() on QueryBuilder - #277
Merged
1 commit merged intoNov 5, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
An AI harness reached for QueryBuilder.skip() and hit a wall: only limit(count, offset?) existed, with offset trapped as a positional arg. Add offset() (SQL-native), skip() (alias of offset - the Mongo/Eloquent name, matches the DocStore cursor + to_mongo()'s skip key) and take() (alias of limit - the Eloquent name, pairs with skip). Flows to both the SQL get() path and to_mongo() with no further wiring. Real-SQLite tests (positive + negative + Mongo-path), mutation-proven. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andre van Zuydam <andrevanzuydam@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An AI harness building on Tina4 reached for
QueryBuilder.skip(n)and hit a wall: the query builder only exposedlimit(count, offset?), with the offset trapped as a positional arg. Devs coming from Mongoose / Eloquent / Knex reach for.skip()/.offset()/.take()and fail — even though the DocStore Mongo cursor already has.skip()andto_mongo()already emits askipkey.Change (minimal, additive)
Three thin chainable setters over the existing internals:
offset(n)— the SQL-native verb (offset was previously only reachable aslimit(n, offset))skip(n)— alias ofoffset; the Mongo/Eloquent name, matches the DocStore cursor +to_mongo()'sskipkeytake(n)— alias oflimit; the Eloquent name, pairs withskip(.skip(20).take(10))Pagination flows to both the SQL
get()path andto_mongo()with no further wiring. CLAUDE.md's QueryBuilder method list updated to match.Tests (real SQLite, no mocks — positive + negative)
.skip(2).limit(2)returns the 3rd+4th rows;.offset()is identical;.take()sets the limit; skip-past-end returns empty (not an error);.skip(5).to_mongo()emits{"skip": 5}; methods return the builder. Mutation-proven: makingskip()a no-op broke exactly the 3 skip-dependent tests.Verification
pytest tests/test_query_builder.py→ 59 passed on thev3(3.13.157) base.Parity
Python is the reference here; sibling PRs land the same API in tina4-php / tina4-ruby / tina4-nodejs.
🤖 Generated with Claude Code